<?php $row_municipio = $municipio->row_array();?>
<div class="container">
    <div id="main">
        <div class="entry single">
            <div class="entry-header">
                <h2 class="title"><?php echo $row_producto['pro_descripcion'];?></h2>
                <p class="meta"><?php echo $row_municipio['desc'];?></p>
                <div class="post-rating">
                    <?php for($x = 0; $x < floor($row_producto['pro_valoracion']); $x++){?>
                        <a href="#"><span class="on"></span></a>
                    <?php }?>
                    <?php for($x = 0; $x < (5 - floor($row_producto['pro_valoracion'])); $x++){?>
                        <a href="#"><span class="off"></span></a>
                    <?php }?>                                        
                    <p><?php echo lang('vote_esta_vivienda');?></p>
                </div>
            </div><!-- end .entry-header -->
            <div class="entry-content">
                <p><?php echo lang('detalles_de_la_vivienda');?>:</p>
                <?php echo $detalle;?>
                <p><?php echo lang('el_establecimiento_dispone_de');?>:</p>
                <?php echo $contenidos;?>
                <p><?php echo lang('para_descansar_tendras_lo_siguiente');?>:</p>
                <?php echo $distribucion;?>
                <p><a href="#" id="enlace_mapa"/>Enlace mapa</a></p>
                <div id="map_canvas"></div>
                <p><?php echo lang('cerca_de_la_vivienda_puede_encontrar');?>:</p>
                <?php echo $distancias;?>
            </div><!-- end .entry-content -->
        </div><!-- end .entry -->
        <ul class="gallery-list clearfix">
            <?php foreach ($foto->result_array() as $clave_foto => $row_foto){?>
                <li class="box" style="width: 333px">
                    <div class="entry-header">
                        <div class="zoom">
                            <a href="<?php echo site_url().$row_foto['url'];?>" class="multi_images" rel="gallery-images" title="<?php echo $row_foto['desc'];?>">
                                <img src="<?php echo site_url().$row_foto['url_thumb'];?>" alt="<?php echo $row_foto['desc'];?>" class="gallery-image" width="310">
                            </a>
                        </div>
                        <h6><?php echo $row_foto['desc'];?></h6>
                    </div><!-- end .entry-header -->
                </li>
            <?php }?>
        </ul>

        <div class="author-bio">
            <img src="<?php echo site_url();?>/public/images/llaves.png" width="100" height="100" alt="<?php echo lang('propietario');?>" class="avatar"/>
            <h4><?php echo lang('sobre_el_propietario').": ".$row_usuario['usu_nombre'];?></h4>
            <p><?php echo lang('informacion_del_usuario');?></p>
            <div style="float: right; width: 520px;">
                <ul class="columnas2">
                    <li><?php echo lang('valoracion_de_los_inquilinos')." ".($row_usuario['usu_valoracion'] != null ? $row_usuario['usu_valoracion'] : "-");?></li>
                    <?php if(isset($direcciones[0])){?>
                    <li><a href="<?php echo site_url('busqueda/ver/'.$direcciones[0][0]);?>"><?php echo $direcciones[0][1];?></a></li>
                    <?php }else{?><li>&nbsp;</li><?php }?>
                    <li><?php echo lang('enviar_un_mensaje');?></li>
                    <?php if(isset($direcciones[1])){?>
                    <li><a href="<?php echo site_url('busqueda/ver/'.$direcciones[1][0]);?>"><?php echo $direcciones[1][1];?></a></li>
                    <?php }else{?><li>&nbsp;</li><?php }?>
                    <?php if(isset($direcciones[2])){?>
                    <li><a href="<?php echo site_url('busqueda/ver/'.$direcciones[2][0]);?>"><?php echo $direcciones[2][1];?></a></li>
                    <?php }else{?><li>&nbsp;</li><?php }?>
                    <li>&nbsp;</li>
                    <?php if(isset($direcciones[3])){?>
                    <li><a href="<?php echo site_url('busqueda/ver/'.$direcciones[3][0]);?>"><?php echo $direcciones[3][1];?></a></li>
                    <?php }else{?><li>&nbsp;</li><?php }?>
                </ul>
            </div>
        </div>
        <div id="comments">
            <div class="box-header">
                <div class="align-left">
                    <span class="comments-count">
                        <em>&nbsp;&nbsp;<?php echo ($comentario->num_rows() > 99 ? $comentario->num_rows() : $comentario->num_rows()."&nbsp;");?></em>
                    </span> 
                    <h6><?php echo lang('comentarios');?></h6>
                </div>

                <div class="align-right">
                    <strong><a href="#respond">+<?php echo lang('comenta_esta_vivienda');?></a></strong>
                </div>
            </div>
            <ol class="comments-list">
                <?php if($comentario->num_rows() > 0){?>
                    <?php foreach ($comentario->result_array() as $key => $value){?>
                    <li class="comment first">
                        <div class="comment-avatar">
                            <img src="<?php echo site_url('public/images/avatar.png');?>" width="60" height="60" alt="Gravatar" class="avatar" />
                        </div><!-- .comment-avatar -->

                        <div class="comment-body">
                            <div class="comment-meta">
                                <a href="#">John Doe</a>, <span class="date"><?php echo $value['com_feccre'];?></span>
                            </div><!-- .comment-meta -->

                            <p><?php echo $value['com_cuerpo'];?></p>
                            <!--ul class="comment-links">
                                <li><a href="#">Send to a Friend</a> <span class="separator">|</span></li>
                                <li><a href="#">Share this Comment</a> <span class="separator">|</span></li>
                                <li><a href="#">Reply</a></li>
                            </ul--><!-- .comment-links -->
                        </div><!-- .comment-body -->
                    </li><!-- .comment -->
                    <?php }?>
                <?php }else{?>
                    <br/><span><?php echo lang('mensaje_ningun_comentario');?></span>
                <?php }?>
            </ol>

        </div><!-- #comments -->

        <ul class="pagination">
            <li class="prev"><a href="#">Prev</a></li>
            <li><a href="#">1</a></li>
            <li class="active"><a href="#">2</a></li>
            <li><a href="#">3</a></li>
            <li class="next"><a href="#">Next</a></li>
        </ul>

        <div id="respond" class="box">
            <div class="box-header">
                <h6 class="align-left"><?php echo lang('dejanos_un')." ";?><span><?php echo lang('comentario');?></span></h6>
                <p class="align-right">
                    <strong><a href="#"><?php echo lang('logueate_para_dejar_un_comentario');?></a></strong>
                </p>
            </div>

            <?php if($this->session->userdata('idusuario') != null){?>
            <form method="post" action="" id="comment-form" class="form clearfix">
                <div class="input_block">
                    <p>
                        <label for="name"><?php echo lang('nombre')." ";?><span>(<?php echo lang('obligatorio');?>)</span></label>
                        <input type="text" name="name" id="name" class="input" value="">
                    </p>

                    <p>
                        <label for="email"><?php echo lang('email')." ";?><span>(<?php echo lang('obligatorio');?>)</span></label>
                        <input type="text" name="email" id="email" class="input" value="">
                    </p>

                    <p>
                        <label for="website"><?php echo lang('pagina_web')." ";?><span>(<?php echo lang('opcional');?>)</span></label>
                        <input type="text" name="website" id="website" class="input" value="">
                    </p>
                </div>

                <div class="textarea_block">
                    <p>
                        <label for="comment"><?php echo lang('comentarios');?></label>
                        <textarea id="comment" rows="10" cols="45" class="input"></textarea>
                    </p>

                    <p>
                        <input type="submit" name="submit" value="<?php echo lang('enviar');?>" class="submit" />
                    </p>
                </div>
            </form>
            <?php }?>
        </div><!-- end #respond -->

        </div><!-- end #main -->
            <div id="sidebar">
                <?php if($ses['p_datefrom'] != '' && $ses['p_dateto'] != ''){?>
                    <div id="recent-tabs" class="box" style="margin-top: 20px">
                        <div class="box-header">
                            <ul class="nav">
                                <li><a class="current" href="#recent-tabs-posts"><?php echo lang('importe');?></a></li>
                            </ul>
                        </div><!-- end .box-header -->
                        <div class="list-wrap">
                        <ul id="recent-tabs-posts">
                            <li style="border: 2px solid #b70e4f;">
                                <?php $dias = $this->general->restar_fechas($ses['p_datefrom'], $ses['p_dateto']);?>
                                <?php echo lang('periodo')." ".$ses['p_datefrom']." - ".$ses['p_dateto'].
                                        " (".$dias." ".($dias > 1 ? lang('noches') : lang('noche')).")";?>
                                <p class="meta" style="text-align: right; "><?php echo lang('total').": ".$suma_tarifa." €";?></p>
                            </li>

                            <?php if($row_producto['pro_impfianza'] > 0){?>
                                <li>
                                    <?php echo lang('importe_para_la_fianza');?>
                                    <?php if($row_producto['pro_pi_fianza'] == 0){echo $row_producto['pro_impfianza']."%";}?>
                                    <?php $fianza = $suma_tarifa * ($row_producto['pro_impfianza'] / 100);?>
                                    <p class="meta" style="text-align: right"><?php echo $fianza." €";?></p>
                                </li>
                            <?php }?>

                            <?php if($row_producto['pro_impreserva'] > 0){?>
                                <li>
                                    <?php echo lang('importe_para_la_reserva');?>
                                    <?php 
                                    if($row_producto['pro_pi_reserva'] == 0){
                                        echo $row_producto['pro_impreserva']."%";
                                        $reserva = $suma_tarifa * ($row_producto['pro_impreserva'] / 100);
                                    }else{
                                        $reserva = $row_producto['pro_impreserva'];
                                    }
                                    ?>
                                    <p class="meta" style="text-align: right"><?php echo $reserva." €";?></p>
                                </li>
                            <?php }?>
                                
                            <?php if($row_producto['pro_limpieza'] > 0){?>
                                <li>
                                    <?php echo lang('importe_para_la_limpieza');?>
                                    <p class="meta" style="text-align: right"><?php echo $row_producto['pro_limpieza']." €";?></p>
                                </li>
                            <?php }?>

                            <li>
                                <p class="meta">
                                    <a href="<?php echo site_url('paypal/auto_form')?>">
                                        <div class="fbutton">
                                            <div>
                                                <span class="reservar" style="padding-left: 20px;"><?php echo lang('reservar');?></span>
                                            </div>
                                        </div>
                                    </a>
                                </p>
                            </li>

                        </ul><!-- end #recent-tabs-posts-->

                        <ul id="recent-tabs-comments" class="hide">

                            <li>
                                <a href="single-post.html" class="title">
                                    <img src="http://1.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=40" width="40" height="40" alt="" />
                                    Lorem ipsum dolor sit amet...
                                </a>
                                <p class="meta">Commented on <a href="#">March 29, 2010</a> by <a href="#">John Doe</a></p>
                            </li>

                            <li>
                                <a href="single-post.html" class="title">
                                    <img src="http://1.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=40" width="40" height="40" alt="" />
                                    Lorem Ipsum is simply dummy text...
                                </a>
                                <p class="meta">Commented on <a href="#">March 17, 2010</a> by <a href="#">John Doe</a></p>
                            </li>

                            <li>
                                <a href="single-post.html" class="title">
                                    <img src="http://1.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=40" width="40" height="40" alt="" />
                                    Lorem ipsum dolor sit amet...
                                </a>
                                <p class="meta">Commented on <a href="#">March 3, 2010</a> by <a href="#">John Doe</a></p>
                            </li>

                        </ul><!-- end #recent-tabs-comments -->

                    </div><!-- end .list-wrap -->
                    </div><!-- end #recent-tabs -->                
                <?php }?>
                <div class="ads box">
                    <ul>
                        <li>
                            <a href="http://themeforest.net/?ref=smuliii"><img width="125" height="125" src="http://envato.s3.amazonaws.com/referrer_adverts/tf_125x125_v5.gif" alt="Themeforest"></a>
                        </li>
                        <li class="even">
                            <a href="http://graphicriver.net/?ref=smuliii"><img width="125" height="125" src="http://envato.s3.amazonaws.com/referrer_adverts/gr_125x125_v4.gif" alt="Graphicriver"></a>
                        </li>
                        <li>
                            <a href="http://activeden.net/?ref=smuliii"><img width="125" height="125" src="http://envato.s3.amazonaws.com/referrer_adverts/ad_125x125_v4.gif" alt="Activeden"></a>
                        </li>
                        <li class="even">
                            <a href="http://codecanyon.net/?ref=smuliii"><img width="125" height="125" src="http://envato.s3.amazonaws.com/referrer_adverts/cc_125x125_v1.gif" alt="CodeCanyon"></a>
                        </li>
                    </ul>

                    <p class="align-center"><a href="#">Advertise With Us</a></p>

                </div><!-- end .ads -->

                    <div class="flickr-feed box">

                            <div class="box-header">

                                    <h6 class="align-left"><img src="img/icon-flickr-feed.png" alt="icon-flickr-feed" class="flickr-icon" /> Our Flickr Group</h6>

                                    <a href="#" class="align-right">Sign In</a>

                            </div><!-- end .box-header -->

                            <ul>
                                    <li>
                                            <a href="http://www.flickr.com/photos/kwl/2432868269/">
                                                    <img src="img/sample-images/75x75.jpg" width="75" height="75" alt="" class="flickr-image" />
                                            </a>
                                    </li>
                                    <li>
                                            <a href="http://www.flickr.com/photos/dexxus/4338578468/">
                                                    <img src="img/sample-images/75x75.jpg" width="75" height="75" alt="" class="flickr-image" />
                                            </a>
                                    </li>
                                    <li>
                                            <a href="http://www.flickr.com/photos/extranoise/158135547/">
                                                    <img src="img/sample-images/75x75.jpg" width="75" height="75" alt="" class="flickr-image" />
                                            </a>
                                    </li>
                                    <li>
                                            <a href="http://www.flickr.com/photos/18614695@N00/3472778601/">
                                                    <img src="img/sample-images/75x75.jpg" width="75" height="75" alt="" class="flickr-image" />
                                            </a>
                                    </li>
                                    <li>
                                            <a href="http://www.flickr.com/photos/notsogoodphotography/466107969/">
                                                    <img src="img/sample-images/75x75.jpg" width="75" height="75" alt="" class="flickr-image" />
                                            </a>
                                    </li>
                                    <li>
                                            <a href="http://www.flickr.com/photos/brunociampi/2487769238/">
                                                    <img src="img/sample-images/75x75.jpg" width="75" height="75" alt="" class="flickr-image" />
                                            </a>
                                    </li>
                            </ul>

                    </div><!-- end .flickr-feed -->

                    <div class="tags box">

                            <div class="box-header">

                                    <h6>TravelGuide Tags</h6>

                            </div><!-- end .box-header -->

                            <ul>
                                    <li><a href="#">New York City</a></li>
                                    <li><a href="#">Australia</a></li>
                                    <li><a href="#">Woods</a></li>
                                    <li><a href="#">Beach</a></li>
                                    <li><a href="#">Brooklyn</a></li>
                                    <li><a href="#">Bridge</a></li>
                                    <li><a href="#">Texas</a></li>
                                    <li><a href="#">2010</a></li>
                                    <li><a href="#">Palmtree</a></li>
                                    <li><a href="#">Miami</a></li>
                                    <li><a href="#">Museum</a></li>
                                    <li><a href="#">Native</a></li>
                                    <li><a href="#">American</a></li>
                                    <li><a href="#">Trips</a></li>
                                    <li><a href="#">Private</a></li>
                                    <li><a href="#">Family</a></li>
                                    <li><a href="#">Photo</a></li>
                            </ul>

                    </div><!-- end .tags -->

                    <img src="img/ad.gif" alt="ad" class="ad-bar" />
                    <a href="http://themeforest.net/?ref=smuliii"><img src="http://envato.s3.amazonaws.com/referrer_adverts/tf_300x250_v5.gif" alt="tf_300x250_v5" class="ad" /></a>

            </div><!-- end #sidebar -->

            <div class="clear"></div>

</div><!-- end .container -->
